#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>
int two_hex(int n)
{
	int outcome = 0;
	int i = 0;
	while (n > 0)
	{
		int x = n % 2;
		n = n / 2;
		outcome += x*pow(10, i); i++;
	}
	return outcome;
}
int eight_hex(int n)
{
	int outcome = 0;
	int i = 0;
	while (n > 0)
	{
		int x = n % 8;
		n = n / 8;
		outcome += x * pow(10, i); i++;
	}
	return outcome;

}
int sixteen_hex(int n)
{
	int outcome = 0;
	int i = 0;
	while (n > 0)
	{
		int x = n % 16;
		n = n / 16;
		outcome += x * pow(10, i); i++;
	}
	return outcome;
}
int main()
{
	int n = 0;
	scanf("%d", &n);
	int result1=two_hex(n);
	printf("%d\n", result1);
	int result2 = eight_hex(n);
	printf("%d\n", result2);
	int result3=sixteen_hex(n);
	printf("%d\n", result3);
	return 0;
}